# Contributor: Sander Maijers <S.N.Maijers+Alpine@gmail.com>
# Maintainer: Sander Maijers <S.N.Maijers+Alpine@gmail.com>
pkgname=xmlsec
pkgver=1.2.30
pkgrel=0
pkgdesc="C based implementation for XML Signature Syntax and Processing and XML Encryption Syntax and Processing"
url="https://github.com/lsh123/xmlsec/"
arch="all"
license="MIT"
makedepends="libxml2-dev libxslt-dev openssl-dev nss-dev
	autoconf automake libtool"
checkdepends="nss-tools"
options="libtool"
subpackages="$pkgname-nss $pkgname-dev $pkgname-doc"
source="https://github.com/lsh123/xmlsec/archive/xmlsec-${pkgver//./_}.tar.gz"
builddir="$srcdir/$pkgname-$pkgname-${pkgver//./_}"

prepare() {
	default_prepare
	autoreconf -fi
}

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--disable-static \
		--enable-pkgconfig \
		--with-openssl=/usr \
		--without-gnutls \
		--without-gcrypt \
		--with-default-crypto=openssl
	make
}

check() {
	make -k check
}

package() {
	make DESTDIR="$pkgdir" install
}

nss() {
	pkgdesc="xmlsec nss plugin"
	install_if="$pkgname=$pkgver-r$pkgrel nss"
	mkdir -p "$subpkgdir"/usr/lib/
	mv "$pkgdir"/usr/lib/libxmlsec1-nss.so* "$subpkgdir"/usr/lib/
}

sha512sums="e631e7b132b39bb53f2713fe34880f8b4e81fd759fd206e8872c066236a8a64713842ba5e0ba9ad2f345f9f6d1da304acbeb61411b52cfa79d2934fc9e260ce9  xmlsec-1_2_30.tar.gz"
